package org.swift.mashup.wsdl;

import javax.xml.stream.XMLStreamException;

import org.jaxen.JaxenException;

public class AxiomOperation implements Operation<AxiomMessage> {

	private String endpoint = null;
	private String inputXml = "";
	private String outputXml = "";
	private String name = "";
	private String soapAction;

	public AxiomOperation(String name, String endpoint, String inputXml,
			String outputXml, String soapAction) {
		this.name = name;
		this.endpoint = endpoint;
		this.inputXml = inputXml;
		this.outputXml = outputXml;
		this.soapAction = soapAction;
	}

	public AxiomMessage createRequest() throws XMLStreamException, JaxenException {
		return new AxiomMessage(inputXml);
	}

	public AxiomMessage createResponse() throws XMLStreamException, JaxenException {
		return new AxiomMessage(outputXml);
	}

	public String getEndpoint() {
		return this.endpoint;
	}

	public String getName() {
		return this.name;
	}
	
	public String getAction(){
		if (this.soapAction != null){
			return this.soapAction;
		}
		return this.getName();
	}
}
